<template>
	<view class="container">
		<view style="width: 100%;height: 20rpx;"></view>
		<view class="list_view">
			<view class="item_view">
				<view class="left_view">
					锁具名称
				</view>
				<view class="right_view">
					{{ dataModel.deviceName }}
				</view>
			</view>
			<view class="item_view">
				<view class="left_view">
					ID
				</view>
				<view class="right_view">
					{{ dataModel.deviceNo }}
				</view>
			</view>
			<view class="item_view">
				<view class="left_view">
					车站
				</view>
				<view class="right_view">
					{{ dataModel.tenantName }}
				</view>
			</view>
			<view class="item_view">
				<view class="left_view">
					区域
				</view>
				<view class="right_view">
					{{ dataModel.area }}
				</view>
			</view>
			<view class="item_view">
				<view class="left_view">
					安装位置
				</view>
				<view class="right_view">
					{{ dataModel.location }}
				</view>
			</view>
			<view class="item_view">
				<view class="left_view">
					授权状态
				</view>
				<view class="right_view" :style="{color: statusColor}">
					{{ deviceAuthorizeStatusEnum(dataModel.status) }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				deviceId: '',
				deviceType: '',
				dataModel: {},
				statusColor: ''
			}
		},
		onLoad() {
			this.deviceId = this.$Route.query.deviceId
			this.deviceType = this.$Route.query.deviceType
			this.getLockDetailData()
		},
		methods: {
			deviceAuthorizeStatusEnum(e) {
				switch (e) {
					case 1:
						this.statusColor = 'red'
						return '未授权'
					case 2:
						this.statusColor = ''
						return '已授权'
					default:
						break
				}
			},
			getLockDetailData() {
				var that = this
				this.$apis.getLockDetail({
					deviceId: this.deviceId,
					deviceType: this.deviceType
				}).then(result => {
					if (result.res.data.code == '200') {
						that.dataModel = result.res.data.data;
					} else {
						that.$show.toastMessage(result.res.data.msg);
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		min-height: 100vh;
		box-sizing: border-box;
		background-color: #F8F8F8;
	}

	.list_view {
		border-top: 1rpx solid #E8E8E8;

		.item_view {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			padding: 15px;
			background-color: #FFFFFF;
			border-bottom: 1rpx solid #E8E8E8;

			.left_view {
				display: flex;
				flex-direction: row;

				.content_view {
					margin-left: 10px;
				}
			}
		}
	}

	.bottom_view {
		width: 100%;
		height: 120rpx;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		background-color: #FFFFFF;

		.again_view {
			width: 40%;
			height: 80rpx;
			color: #324DEC;
			border: 1px solid #324DEC;
			display: flex;
			justify-content: center;
			align-items: center;
			border-radius: 40rpx;
		}

		.next_view {
			width: 50%;
			height: 80rpx;
			background-color: #324DEC;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #FFFFFF;
			border-radius: 40rpx;
		}
	}
</style>